package com.langfeiyes.pattern.iterator;

import java.sql.Array;
import java.util.ArrayList;
import java.util.List;

public class ConcreteAggregate<E>  extends Aggregate<E> {

    private List<E> elements = new ArrayList<>();

    public ConcreteAggregate(List<E> elements){
        this.elements = elements;
    }

    @Override
    Iterator iterator() {
        return new ConcreteIterator(this);
    }

    @Override
    E get(int index) {
        return elements.get(index);
    }

    @Override
    int size() {
        return elements.size();
    }
}
